<template>
  <div class="app-container">
    <el-card class="box-card" :style="{height:heights+'px'}">
    <el-form ref="elForm" :model="formData" :rules="rules" size="medium" label-width="100px" >

      <el-row  type="flex" justify="center" align="middle" style="margin-top:5%">
        <img :src="defaultImg" style="width: 30%;height: 15%"/>
      </el-row>
      <el-row gutter="15" type="flex" justify="center" align="middle" style="margin-top:2%">
        <el-col :span="3">
          <el-input
            v-model="queryParams.barcode"
            placeholder="请输入条码"
            clearable
            @keyup.enter.native="getLista"
          />
           <!-- <el-select v-model="formData.field103" placeholder="请输入条码号" clearable :style="{width: '100%'}">
              <el-option v-for="(item, index) in field103Options" :key="index" :label="item.label"
                         :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>-->

        </el-col>
        <el-col :span="2">

            <el-select v-model="formData.field104" placeholder="分类" clearable :style="{width: '100%'}">
              <el-option v-for="(item, index) in field104Options" :key="index" :label="item.label"
                         :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>
      <!--    <el-input
            v-model="queryParams.dataname"
            placeholder="请输入名称"
            clearable
            @keyup.enter.native="handleQuery"
          />-->
        </el-col>
        <el-col :span="6">

         <!--   <el-select v-model="formData.field105" placeholder="请输入关键字" clearable :style="{width: '100%'}">
              <el-option v-for="(item, index) in field105Options" :key="index" :label="item.label"
                         :value="item.value" :disabled="item.disabled"></el-option>
            </el-select>-->
          <el-input
            v-model="queryParams.note10"
            placeholder="请输入关键字"
            clearable
            @keyup.enter.native="getLista"
          />
        </el-col>
        <el-col :span="2">

          <el-button type="primary"  size="medium" @click="getLista">检索</el-button>

        </el-col>
      </el-row>

    </el-form>
    </el-card>
  </div>
</template>
<script>
  import deImg  from '@/assets/images/map.png';
  import { listMap, getMap, delMap, addMap, updateMap } from "@/api/group/whd/map";
  export default {
    components: {},
    props: [],
    data() {
      return {
        formData: {
          field104: undefined,
        },
        defaultImg:deImg,
        heights:'',

        rules: {

        },
        field104Options: [{
          "label": "名称",
          "value": 'mapname'
        }, {
          "label": "第一责任人",
          "value": 'firstname'
        },
          {
            "label": "存放位置",
            "value": 'maplocal'
          },

        ],
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 地图信息表格数据
        mapList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
          dataname: null,
          firstpeople: null,
          position: null,
          category: null,
          secondclassify: null,
          barcode: null,
          daydate: null,
          status: null,
          enclosure: null,
          userId: null,
          deptId: null,
          createBy: null,
          createTime: null,
          updateBy: null,
          updateTime: null,
          remark: null,
          note1: null,
          note2: null,
          note3: null,
          note4: null,
          note5: null,
          note6: null,
          note7: null,
          note8: null,
          note9: null,
          note10: null
        },

      }

    },
    computed: {},
    watch: {},
    created() {
      this.etBodyContentHeight()
    },
    mounted:function(){
      const self = this
      //onresize 事件会在窗口或框架被调整大小时发生。
      window.onresize = function(){
        self.etBodyContentHeight()
      }
    },

    methods: {

      getLista(row) {
        //const id = row.id;
        // const tableName = row.tableName || this.tableNames[0];
        //const params = {pageNum: this.queryParams.pageNum};
           const temp = this.formData.field104;
        const temp1 = this.queryParams.note10;

        const barcode = this.queryParams.barcode;
        console.log(temp+"temp")
        if(temp=="mapname"){
console.log(1);
          this.$router.push({path: "/basedata/mapdata", query: {mapname:temp1,barcode:barcode}});
        }else if(temp=="firstname"){
          this.$router.push({path: "/basedata/mapdata", query: {firstname:temp1,barcode:barcode}});
        }else if(temp=="maplocal"){
          this.$router.push({path: "/basedata/mapdata", query: {maplocal:temp1,barcode:barcode}});
        }else if(barcode!=null){
          this.$router.push({path: "/basedata/mapdata", query: {barcode:barcode}});
        }
        else{
          this.$router.push({path: "/basedata/mapdata", query: {}});
        }


       // this.$router.push({path: "/map/mapdata", query: {temp:temp}});
      },

      etBodyContentHeight(){
        //设置根据浏览器可视窗口高度
        var height = window.innerHeight || document.documentElement.clientHeight
        this.heights = (height-100)
        console.log(this.heights)
        // return this.heights
      },

      resetForm() {
        this.$refs['elForm'].resetFields()
      },
    }
  }

</script>
<style>
</style>
